package cn.schtwz.baseproject.ui.homeEmergency

import androidx.lifecycle.MutableLiveData
import cn.schtwz.baselib.base.BaseViewModel
import cn.schtwz.baseproject.bean.ArticleBean
import kotlinx.coroutines.async


class HomeEmEViewModel(val repository: HomeEmERepository) : BaseViewModel() {
    val datas: MutableLiveData<String> by lazy { MutableLiveData<String>() }

    /**
     * 同时请求多个数据
     */
    fun onRefresh() = launchUI({
        val one = async {
            repository.getDatas()
        }
        val two = async {
            repository.getDatas()
        }
        val oneR = one.await()
        val twoR = two.await()
        datas.value = oneR.data[0].name
    }, {
    })

}